<% content_for :sidebar do %>
  <%= edit_item_button %>
  <%= add_repair_button %>
  <%= add_inspection_button %>
<% end %>

<h3>
  <%= link_to @item.item_category,
                item_category_path(@item.item_category) %> >
  <%= link_to @item.item_type, item_type_path(@item.item_type) %> >
  <%= @item.name %>
</h3>

<h3>
  <% if @item.status.present? %>
    <%= item_status_label(@item) %> &nbsp;
  <% end %>

  <% if @item.condition.present? %>
    <%= item_condition_label(@item) %> &nbsp;
  <% end %>
  <br/><br/>
  <% if @item.brand.present? || @item.model.present? %>
    <%= @item.brand %> <%= @item.model %>
  <% end %>
</h3>

<% if @item.description.present? %>
  <p><b>Description:</b> <%= @item.description %></p>
<% end %>

<% if @item.location.present? %>
  <p><b>Location:</b> <%= @item.location %></p>
<% end %>

<% if @item.vendor.present? %>
  <p><b>Vendor:</b> <%= link_to @item.vendor.name, @item.vendor %></p>
<% end %>

<% if @item.owner.present? %>
  <p><b>Owner:</b> <%= @item.owner.fullname %></p>
<% end %>

<% if @item.purchase_date.present? %>
  <p><b>Purchase date:</b> <%= @item.purchase_date %></p>
<% end %>

<p><b>Expenses in last 6 months </b><%= number_to_currency @item.recent_costs %></p>
<p>Quantity: <b><%= @item.qty %></b></p>

<% if @item.purchase_amt.present? %>
  <p><b>Purchase amt:</b> <%= @item.purchase_amt %></p>
<% end %>

<% if @item.grant.present? %>
  <p><b>Grant</b> <%= @item.grant %></p>
<% end %>

<% if @item.sell_date.present? %>
  <p><b>Sell date:</b> <%= @item.sell_date %></p>
  <p> <b>Sell amt:</b> <%= @item.sell_amt %></p>
<% end %>

<% @item.unique_ids.each do |id| %>
  Unique ID <b><%= id.value %> <%= id.category %></b><br/>
<% end %>

<%= render(:partial => "repairs/repairs_table", :repairs => @item.repairs) || "No Repairs yet !" %>
<hr>
<%= render(:partial => "inspections/inspections_table", :inpections => @item.inspections) || "No Inspections yet !" %>
<%= image_tag @item.item_image.to_s if @item.item_image.present? %>

<span>
  Created <%= @item.created_at %><br/>
  Last Modified <%= @item.updated_at %><br/>
  Last Editor <%= @last_editor %>
</span>
